package com.ruoyi.web.controller.system;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.OutiftsTrialRecord;
import com.ruoyi.system.service.IOutiftsTrialRecordService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 装扮试用信息Controller
 * 
 * @author ruoyi
 * @date 2025-02-10
 */
@RestController
@RequestMapping("/system/trial")
public class OutiftsTrialRecordController extends BaseController
{
    @Autowired
    private IOutiftsTrialRecordService outiftsTrialRecordService;

    /**
     * 查询装扮试用信息列表
     */
    @PreAuthorize("@ss.hasPermi('system:trial:list')")
    @GetMapping("/list")
    public TableDataInfo list(OutiftsTrialRecord outiftsTrialRecord)
    {
        startPage();
        List<OutiftsTrialRecord> list = outiftsTrialRecordService.selectOutiftsTrialRecordList(outiftsTrialRecord);
        return getDataTable(list);
    }

    /**
     * 导出装扮试用信息列表
     */
    @PreAuthorize("@ss.hasPermi('system:trial:export')")
    @Log(title = "装扮试用信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, OutiftsTrialRecord outiftsTrialRecord)
    {
        List<OutiftsTrialRecord> list = outiftsTrialRecordService.selectOutiftsTrialRecordList(outiftsTrialRecord);
        ExcelUtil<OutiftsTrialRecord> util = new ExcelUtil<OutiftsTrialRecord>(OutiftsTrialRecord.class);
        util.exportExcel(response, list, "装扮试用信息数据");
    }

    /**
     * 获取装扮试用信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:trial:query')")
    @GetMapping(value = "/{trialRecordId}")
    public AjaxResult getInfo(@PathVariable("trialRecordId") Long trialRecordId)
    {
        return success(outiftsTrialRecordService.selectOutiftsTrialRecordByTrialRecordId(trialRecordId));
    }

    /**
     * 新增装扮试用信息
     */
    @PreAuthorize("@ss.hasPermi('system:trial:add')")
    @Log(title = "装扮试用信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody OutiftsTrialRecord outiftsTrialRecord)
    {
        return toAjax(outiftsTrialRecordService.insertOutiftsTrialRecord(outiftsTrialRecord));
    }

    /**
     * 修改装扮试用信息
     */
    @PreAuthorize("@ss.hasPermi('system:trial:edit')")
    @Log(title = "装扮试用信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody OutiftsTrialRecord outiftsTrialRecord)
    {
        return toAjax(outiftsTrialRecordService.updateOutiftsTrialRecord(outiftsTrialRecord));
    }

    /**
     * 删除装扮试用信息
     */
    @PreAuthorize("@ss.hasPermi('system:trial:remove')")
    @Log(title = "装扮试用信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{trialRecordIds}")
    public AjaxResult remove(@PathVariable Long[] trialRecordIds)
    {
        return toAjax(outiftsTrialRecordService.deleteOutiftsTrialRecordByTrialRecordIds(trialRecordIds));
    }
}
